/* eslint-disable camelcase */
import { T_srv, Tsrv, ifs, ts, tvs, vue } from '@/services';
import G6 from '@antv/g6';
import { GraphOptions } from '@antv/g6-core/lib/types';

// const getGridOpt = (obj: any) => {
//   return {
//     // 边框 default（默认）, full（完整边框）, outer（外边框）, inner（内边框）, none（无边框）
//     border: true,
//     // 斑马纹
//     stripe: true,
//     // round: true,

//     data: [],
//     pagerConfig: {
//       pageSize: 10,
//       autoHidden: false,
//       pageSizes: [5, 10, 15, 20, 50, 100, 200, 500, 1000]
//     },
//     toolbarConfig: {
//       size: 'mini',
//       refresh: {
//         query: obj.loadData
//       },
//       zoom: true,
//       custom: {
//         immediate: true,
//         isFooter: false
//       }
//     },
//     seqConfig: {
//       startIndex: 1
//     },
//     rowConfig: {
//       keyField: 'id',
//       isCurrent: true,
//       isHover: true
//     },
//     columnConfig: {
//       // 每列最小宽度
//       minWidth: '60px',
//       isCurrent: true,
//       isHover: true,
//       resizable: true
//     },
//     filterConfig: {
//       remote: true
//     },
//     columns: [
//       // {
//       //   field: 'id',
//       //   title: 'ID',
//       //   sortable: true
//       // },
//       // {
//       //   field: 'code',
//       //   title: '编号',
//       //   sortable: true
//       // },
//       // {
//       //   field: 'name',
//       //   title: '名称',
//       //   width: 120,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'version',
//       //   title: '版本号',
//       //   width: 80,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'confirm',
//       //   title: '有效码',
//       //   sortable: true
//       // },
//       // {
//       //   field: 'state',
//       //   title: '状态',
//       //   visible: true,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'classify',
//       //   title: '适用产品类'
//       // },
//       // {
//       //   field: 'createTime',
//       //   title: '建档时间',
//       //   width: 160,
//       //   visible: true,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'biller',
//       //   title: '资料建立者',
//       //   width: 160,
//       //   visible: true,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'lastModifyUser',
//       //   title: '最近修改人',
//       //   width: 160,
//       //   visible: true,
//       //   sortable: true
//       // },
//       // {
//       //   field: 'lastModifyTime',
//       //   title: '最近修改时间',
//       //   width: 160,
//       //   visible: true,
//       //   sortable: true
//       // }
//     ]
//   };
// };

const graphCfg = (): GraphOptions => {
  return {
    container: '',
    height: 400,
    width: 300,
    // Boolean，可选，切换布局时是否使用动画过度
    animate: false,
    // 设置为true，启用 redo & undo 栈功能
    enabledStack: true,
    // redo & undo 最大步数, 只有当 enabledStack 为 true 时才起作用，该配置项 V3.6 及以上版本支持。
    maxStep: 100,
    renderer: 'canvas', // svg | canvas 默认canvas
    // 开启画布自适应
    fitView: true,
    fitViewPadding: 100,
    modes: {
      // 支持的 behavior
      default: ['drag-canvas', 'zoom-canvas']
    }

    // 不自动布局，在graphToolbar.ts中外挂布局 这样保存的数据在打开时由于自动布局导致位置变化
    // layout: {
    //   type: 'rule-tree-layout',
    //   // 节点的最大宽度
    //   maxNodeWidth: 100,
    //   // 节点之间距离
    //   nodeDisX: 200,
    //   nodeDisY: 200
    // }
  };
};
const gridConf = () => {
  return {
    name: '_sys_rule_lib',
    comment: '规则逻辑库',
    isCreated: false,
    status: 'main',
    tableStyle: {
      showHeader: true,
      showFooter: false,
      showPager: true,
      showToolbar: true,
      border: false,
      mode: null
    },
    editWindow: false,
    dbType: 'mongo',
    tableColumns: [
      {
        fieldID: '401343338214588416',
        field: 'rule_number',
        type: 'varchar(45)',
        isShow: true,
        notNull: true,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          isFunLayout: true,
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222301287968935993',
        field: 'f_name',
        type: 'varchar(45)',
        isShow: true,
        notNull: true,
        defValue: '0',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: true,
        many2one: {
          toTable: '',
          toField: '',
          isDropdown: false,
          customSearch: '',
          multiConnect: '',
          isFunLayout: true,
          fields: []
        },
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454937226250297344',
        field: 'version',
        type: 'varchar(45)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222301287968935965',
        field: 'f_comment',
        type: 'varchar(200)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '368215066308247552',
        field: 'f_trigger',
        type: 'varchar(45)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '368283725038878720',
        field: 'input_arg',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454938359458963456',
        field: 'output_arg',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454939775837675520',
        field: 'graph_data',
        type: 'mediumtext',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454990837290377216',
        field: 'node_attr',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454991228996427776',
        field: 'rule_attr',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222308141738496001',
        field: 'class_code',
        type: 'varchar(45)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '222308141738496005',
        field: 'f_enabled',
        type: 'bit(1)',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454992136232771584',
        field: 'dsl_code',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454993315142574080',
        field: 'dsl_output_arg',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454992958136000512',
        field: 'dsl_input_arg',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      },
      {
        fieldID: '454994259024551936',
        field: 'source_code',
        type: 'text',
        isShow: true,
        notNull: false,
        defValue: '',
        comment: '',
        selectionID: null,
        disabled: false,
        defaultFilter: false,
        nodeData: false,
        footerMethod: null,
        formatter: {
          type: '',
          decimal: 0,
          thousandmark: false,
          currency: ''
        },
        actions: { dochange: '' },
        auxProp: '',
        minWidth: '',
        appWeight: '',
        isDes: false,
        many2one: '',
        align: 'left',
        subQuery: ''
      }
    ],
    uniqueIndexes: [
      [{ id: '222301287968935993', name: 'f_name' }],
      [{ id: '401343338214588416', name: 'rule_number' }]
    ],
    indexes: [],
    rules: [],
    selbill: [],
    queryLink: [],
    action: {},
    headerGroup: [],
    charts: [],
    qbeSearch: { enable: false, position: 'top' },
    toolbar: {
      insert: true,
      default: true,
      delete: true,
      save: true,
      import: true,
      export: true,
      globalSearch: true,
      refresh: true,
      edit: true,
      print: true,
      audit: false,
      unaudit: false,
      search: true,
      pasteColumn: false,
      addon: []
    },
    tableDataSetting: { editable: true, autoload: true },
    messageConfig: {
      custDefListener: { coordination: 'BDFEC4E6666C20B5999' },
      emitActions: { search: [], refresh: [] },
      eventGroup: {}
    },
    triggerEvent: { rowDbClick: false, groupByField: [] },
    permission: [
      {
        type: 'button',
        area: 'toolbar',
        data: {
          addon: 1,
          audit: 1,
          default: 1,
          delete: 1,
          edit: 1,
          export: 1,
          globalSearch: 1,
          import: 1,
          insert: 1,
          pasteColumn: 1,
          print: 1,
          refresh: 1,
          save: 1,
          search: 1,
          unaudit: 1
        }
      },
      { type: 'NULL', area: 'default', data: { browse: 1 } },
      {
        type: 'columns',
        area: 'table',
        data: {
          class_code: 1,
          dsl_code: 1,
          dsl_input_arg: 1,
          dsl_output_arg: 1,
          f_comment: 1,
          f_enabled: 1,
          f_name: 1,
          f_trigger: 1,
          graph_data: 1,
          input_args: 1,
          node_attr: 1,
          output_arg: 1,
          rule_attr: 1,
          rule_number: 1,
          source_code: 1,
          version: 1
        }
      }
    ],
    audit: { hasRequestAudit: false },
    mainFun: '_sys_rule_lib'
  };
};

export { G6, GraphOptions, T_srv, Tsrv, graphCfg, gridConf, ifs, ts, tvs, vue };
